package com.suliao.pay.controller;


import com.suliao.common.base.BaseChannel;
import com.suliao.common.util.RocketMQUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * @author： M1nG-CodeGenerator
 * @since： 2020-09-10 17:35:51
 * @description： mq demo前端控制器
 * @version： 1.0
 */
@RestController
@RequestMapping(value = "/mq")
@Slf4j
public class TestController {

    @Autowired
    BaseChannel baseChannel;
    @Autowired
    RocketMQUtil rocketMQUtil;

    @GetMapping("/sendMsg")
    public String sendMsg() {
        baseChannel.output().send(MessageBuilder.withPayload("测试stream消息体").build());
        return "success";
    }

    @GetMapping("/sendMsg2")
    public String sendMsg2() {
        rocketMQUtil.sendMsg("test-topic-1","嘿嘿嘿");
        return "success";
    }


}
